import paho.mqtt.client as mqtt


def on_connect(client, userdata, flags, rc):
    print("Connected with result code " + str(rc))


def on_message(client, userdata, msg):
    print(msg.topic + " " + ":" + str(msg.payload))


def on_disconnect(client, userdata, rc):
    print("Disconnect userdata code " + str(userdata))


client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.on_disconnect = on_disconnect
client.connect("139.217.237.110", 1883, 60)
client.subscribe("control")
client.loop_forever()
